// Copyright 2025 Google LLC
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
//     https://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
//
// Code generated by sidekick. DO NOT EDIT.

pub mod storage_control {
    use crate::Result;

    /// Common implementation for [crate::client::StorageControl] request builders.
    #[derive(Clone, Debug)]
    pub(crate) struct RequestBuilder<R: std::default::Default> {
        stub: std::sync::Arc<dyn super::super::stub::dynamic::StorageControl>,
        request: R,
        options: gax::options::RequestOptions,
    }

    impl<R> RequestBuilder<R>
    where
        R: std::default::Default,
    {
        pub(crate) fn new(
            stub: std::sync::Arc<dyn super::super::stub::dynamic::StorageControl>,
        ) -> Self {
            Self {
                stub,
                request: R::default(),
                options: gax::options::RequestOptions::default(),
            }
        }
    }

    /// The request builder for [StorageControl::create_folder][crate::client::StorageControl::create_folder] calls.
    ///
    /// # Example
    /// ```no_run
    /// # use google_cloud_storage::builder;
    /// use builder::storage_control::CreateFolder;
    /// # tokio_test::block_on(async {
    ///
    /// let builder = prepare_request_builder();
    /// let response = builder.send().await?;
    /// # gax::Result::<()>::Ok(()) });
    ///
    /// fn prepare_request_builder() -> CreateFolder {
    ///   # panic!();
    ///   // ... details omitted ...
    /// }
    /// ```
    #[derive(Clone, Debug)]
    pub struct CreateFolder(RequestBuilder<crate::model::CreateFolderRequest>);

    impl CreateFolder {
        pub(crate) fn new(
            stub: std::sync::Arc<dyn super::super::stub::dynamic::StorageControl>,
        ) -> Self {
            Self(RequestBuilder::new(stub))
        }

        /// Sets the full request, replacing any prior values.
        pub fn with_request<V: Into<crate::model::CreateFolderRequest>>(mut self, v: V) -> Self {
            self.0.request = v.into();
            self
        }

        /// Sets all the options, replacing any prior values.
        pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
            self.0.options = v.into();
            self
        }

        /// Sends the request.
        pub async fn send(self) -> Result<crate::model::Folder> {
            let req = Self::auto_populate(self.0.request, false);
            (*self.0.stub)
                .create_folder(req, self.0.options)
                .await
                .map(gax::response::Response::into_body)
        }

        fn auto_populate(
            mut req: crate::model::CreateFolderRequest,
            force: bool,
        ) -> crate::model::CreateFolderRequest {
            if force || req.request_id.is_empty() {
                req = req.set_request_id(uuid::Uuid::new_v4().to_string())
            }
            req
        }

        /// Sets the value of [parent][crate::model::CreateFolderRequest::parent].
        ///
        /// This is a **required** field for requests.
        pub fn set_parent<T: Into<std::string::String>>(mut self, v: T) -> Self {
            self.0.request.parent = v.into();
            self
        }

        /// Sets the value of [folder][crate::model::CreateFolderRequest::folder].
        ///
        /// This is a **required** field for requests.
        pub fn set_folder<T>(mut self, v: T) -> Self
        where
            T: std::convert::Into<crate::model::Folder>,
        {
            self.0.request.folder = std::option::Option::Some(v.into());
            self
        }

        /// Sets or clears the value of [folder][crate::model::CreateFolderRequest::folder].
        ///
        /// This is a **required** field for requests.
        pub fn set_or_clear_folder<T>(mut self, v: std::option::Option<T>) -> Self
        where
            T: std::convert::Into<crate::model::Folder>,
        {
            self.0.request.folder = v.map(|x| x.into());
            self
        }

        /// Sets the value of [folder_id][crate::model::CreateFolderRequest::folder_id].
        ///
        /// This is a **required** field for requests.
        pub fn set_folder_id<T: Into<std::string::String>>(mut self, v: T) -> Self {
            self.0.request.folder_id = v.into();
            self
        }

        /// Sets the value of [recursive][crate::model::CreateFolderRequest::recursive].
        pub fn set_recursive<T: Into<bool>>(mut self, v: T) -> Self {
            self.0.request.recursive = v.into();
            self
        }

        /// Sets the value of [request_id][crate::model::CreateFolderRequest::request_id].
        pub fn set_request_id<T: Into<std::string::String>>(mut self, v: T) -> Self {
            self.0.request.request_id = v.into();
            self
        }
    }

    #[doc(hidden)]
    impl gax::options::internal::RequestBuilder for CreateFolder {
        fn request_options(&mut self) -> &mut gax::options::RequestOptions {
            &mut self.0.options
        }
    }

    /// The request builder for [StorageControl::delete_folder][crate::client::StorageControl::delete_folder] calls.
    ///
    /// # Example
    /// ```no_run
    /// # use google_cloud_storage::builder;
    /// use builder::storage_control::DeleteFolder;
    /// # tokio_test::block_on(async {
    ///
    /// let builder = prepare_request_builder();
    /// let response = builder.send().await?;
    /// # gax::Result::<()>::Ok(()) });
    ///
    /// fn prepare_request_builder() -> DeleteFolder {
    ///   # panic!();
    ///   // ... details omitted ...
    /// }
    /// ```
    #[derive(Clone, Debug)]
    pub struct DeleteFolder(RequestBuilder<crate::model::DeleteFolderRequest>);

    impl DeleteFolder {
        pub(crate) fn new(
            stub: std::sync::Arc<dyn super::super::stub::dynamic::StorageControl>,
        ) -> Self {
            Self(RequestBuilder::new(stub))
        }

        /// Sets the full request, replacing any prior values.
        pub fn with_request<V: Into<crate::model::DeleteFolderRequest>>(mut self, v: V) -> Self {
            self.0.request = v.into();
            self
        }

        /// Sets all the options, replacing any prior values.
        pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
            self.0.options = v.into();
            self
        }

        /// Sends the request.
        pub async fn send(self) -> Result<()> {
            let req = Self::auto_populate(self.0.request, false);
            (*self.0.stub)
                .delete_folder(req, self.0.options)
                .await
                .map(gax::response::Response::into_body)
        }

        fn auto_populate(
            mut req: crate::model::DeleteFolderRequest,
            force: bool,
        ) -> crate::model::DeleteFolderRequest {
            if force || req.request_id.is_empty() {
                req = req.set_request_id(uuid::Uuid::new_v4().to_string())
            }
            req
        }

        /// Sets the value of [name][crate::model::DeleteFolderRequest::name].
        ///
        /// This is a **required** field for requests.
        pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
            self.0.request.name = v.into();
            self
        }

        /// Sets the value of [if_metageneration_match][crate::model::DeleteFolderRequest::if_metageneration_match].
        pub fn set_if_metageneration_match<T>(mut self, v: T) -> Self
        where
            T: std::convert::Into<i64>,
        {
            self.0.request.if_metageneration_match = std::option::Option::Some(v.into());
            self
        }

        /// Sets or clears the value of [if_metageneration_match][crate::model::DeleteFolderRequest::if_metageneration_match].
        pub fn set_or_clear_if_metageneration_match<T>(mut self, v: std::option::Option<T>) -> Self
        where
            T: std::convert::Into<i64>,
        {
            self.0.request.if_metageneration_match = v.map(|x| x.into());
            self
        }

        /// Sets the value of [if_metageneration_not_match][crate::model::DeleteFolderRequest::if_metageneration_not_match].
        pub fn set_if_metageneration_not_match<T>(mut self, v: T) -> Self
        where
            T: std::convert::Into<i64>,
        {
            self.0.request.if_metageneration_not_match = std::option::Option::Some(v.into());
            self
        }

        /// Sets or clears the value of [if_metageneration_not_match][crate::model::DeleteFolderRequest::if_metageneration_not_match].
        pub fn set_or_clear_if_metageneration_not_match<T>(
            mut self,
            v: std::option::Option<T>,
        ) -> Self
        where
            T: std::convert::Into<i64>,
        {
            self.0.request.if_metageneration_not_match = v.map(|x| x.into());
            self
        }

        /// Sets the value of [request_id][crate::model::DeleteFolderRequest::request_id].
        pub fn set_request_id<T: Into<std::string::String>>(mut self, v: T) -> Self {
            self.0.request.request_id = v.into();
            self
        }
    }

    #[doc(hidden)]
    impl gax::options::internal::RequestBuilder for DeleteFolder {
        fn request_options(&mut self) -> &mut gax::options::RequestOptions {
            &mut self.0.options
        }
    }

    /// The request builder for [StorageControl::get_folder][crate::client::StorageControl::get_folder] calls.
    ///
    /// # Example
    /// ```no_run
    /// # use google_cloud_storage::builder;
    /// use builder::storage_control::GetFolder;
    /// # tokio_test::block_on(async {
    ///
    /// let builder = prepare_request_builder();
    /// let response = builder.send().await?;
    /// # gax::Result::<()>::Ok(()) });
    ///
    /// fn prepare_request_builder() -> GetFolder {
    ///   # panic!();
    ///   // ... details omitted ...
    /// }
    /// ```
    #[derive(Clone, Debug)]
    pub struct GetFolder(RequestBuilder<crate::model::GetFolderRequest>);

    impl GetFolder {
        pub(crate) fn new(
            stub: std::sync::Arc<dyn super::super::stub::dynamic::StorageControl>,
        ) -> Self {
            Self(RequestBuilder::new(stub))
        }

        /// Sets the full request, replacing any prior values.
        pub fn with_request<V: Into<crate::model::GetFolderRequest>>(mut self, v: V) -> Self {
            self.0.request = v.into();
            self
        }

        /// Sets all the options, replacing any prior values.
        pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
            self.0.options = v.into();
            self
        }

        /// Sends the request.
        pub async fn send(self) -> Result<crate::model::Folder> {
            let req = Self::auto_populate(self.0.request, false);
            (*self.0.stub)
                .get_folder(req, self.0.options)
                .await
                .map(gax::response::Response::into_body)
        }

        fn auto_populate(
            mut req: crate::model::GetFolderRequest,
            force: bool,
        ) -> crate::model::GetFolderRequest {
            if force || req.request_id.is_empty() {
                req = req.set_request_id(uuid::Uuid::new_v4().to_string())
            }
            req
        }

        /// Sets the value of [name][crate::model::GetFolderRequest::name].
        ///
        /// This is a **required** field for requests.
        pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
            self.0.request.name = v.into();
            self
        }

        /// Sets the value of [if_metageneration_match][crate::model::GetFolderRequest::if_metageneration_match].
        pub fn set_if_metageneration_match<T>(mut self, v: T) -> Self
        where
            T: std::convert::Into<i64>,
        {
            self.0.request.if_metageneration_match = std::option::Option::Some(v.into());
            self
        }

        /// Sets or clears the value of [if_metageneration_match][crate::model::GetFolderRequest::if_metageneration_match].
        pub fn set_or_clear_if_metageneration_match<T>(mut self, v: std::option::Option<T>) -> Self
        where
            T: std::convert::Into<i64>,
        {
            self.0.request.if_metageneration_match = v.map(|x| x.into());
            self
        }

        /// Sets the value of [if_metageneration_not_match][crate::model::GetFolderRequest::if_metageneration_not_match].
        pub fn set_if_metageneration_not_match<T>(mut self, v: T) -> Self
        where
            T: std::convert::Into<i64>,
        {
            self.0.request.if_metageneration_not_match = std::option::Option::Some(v.into());
            self
        }

        /// Sets or clears the value of [if_metageneration_not_match][crate::model::GetFolderRequest::if_metageneration_not_match].
        pub fn set_or_clear_if_metageneration_not_match<T>(
            mut self,
            v: std::option::Option<T>,
        ) -> Self
        where
            T: std::convert::Into<i64>,
        {
            self.0.request.if_metageneration_not_match = v.map(|x| x.into());
            self
        }

        /// Sets the value of [request_id][crate::model::GetFolderRequest::request_id].
        pub fn set_request_id<T: Into<std::string::String>>(mut self, v: T) -> Self {
            self.0.request.request_id = v.into();
            self
        }
    }

    #[doc(hidden)]
    impl gax::options::internal::RequestBuilder for GetFolder {
        fn request_options(&mut self) -> &mut gax::options::RequestOptions {
            &mut self.0.options
        }
    }

    /// The request builder for [StorageControl::list_folders][crate::client::StorageControl::list_folders] calls.
    ///
    /// # Example
    /// ```no_run
    /// # use google_cloud_storage::builder;
    /// use builder::storage_control::ListFolders;
    /// # tokio_test::block_on(async {
    /// use gax::paginator::ItemPaginator;
    ///
    /// let builder = prepare_request_builder();
    /// let mut items = builder.by_item();
    /// while let Some(result) = items.next().await {
    ///   let item = result?;
    /// }
    /// # gax::Result::<()>::Ok(()) });
    ///
    /// fn prepare_request_builder() -> ListFolders {
    ///   # panic!();
    ///   // ... details omitted ...
    /// }
    /// ```
    #[derive(Clone, Debug)]
    pub struct ListFolders(RequestBuilder<crate::model::ListFoldersRequest>);

    impl ListFolders {
        pub(crate) fn new(
            stub: std::sync::Arc<dyn super::super::stub::dynamic::StorageControl>,
        ) -> Self {
            Self(RequestBuilder::new(stub))
        }

        /// Sets the full request, replacing any prior values.
        pub fn with_request<V: Into<crate::model::ListFoldersRequest>>(mut self, v: V) -> Self {
            self.0.request = v.into();
            self
        }

        /// Sets all the options, replacing any prior values.
        pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
            self.0.options = v.into();
            self
        }

        /// Sends the request.
        pub async fn send(self) -> Result<crate::model::ListFoldersResponse> {
            (*self.0.stub)
                .list_folders(self.0.request, self.0.options)
                .await
                .map(gax::response::Response::into_body)
        }

        /// Streams each page in the collection.
        pub fn by_page(
            self,
        ) -> impl gax::paginator::Paginator<crate::model::ListFoldersResponse, gax::error::Error>
        {
            use std::clone::Clone;
            let token = self.0.request.page_token.clone();
            let execute = move |token: String| {
                let mut builder = self.clone();
                builder.0.request = builder.0.request.set_page_token(token);
                builder.send()
            };
            gax::paginator::internal::new_paginator(token, execute)
        }

        /// Streams each item in the collection.
        pub fn by_item(
            self,
        ) -> impl gax::paginator::ItemPaginator<crate::model::ListFoldersResponse, gax::error::Error>
        {
            use gax::paginator::Paginator;
            self.by_page().items()
        }

        /// Sets the value of [parent][crate::model::ListFoldersRequest::parent].
        ///
        /// This is a **required** field for requests.
        pub fn set_parent<T: Into<std::string::String>>(mut self, v: T) -> Self {
            self.0.request.parent = v.into();
            self
        }

        /// Sets the value of [page_size][crate::model::ListFoldersRequest::page_size].
        pub fn set_page_size<T: Into<i32>>(mut self, v: T) -> Self {
            self.0.request.page_size = v.into();
            self
        }

        /// Sets the value of [page_token][crate::model::ListFoldersRequest::page_token].
        pub fn set_page_token<T: Into<std::string::String>>(mut self, v: T) -> Self {
            self.0.request.page_token = v.into();
            self
        }

        /// Sets the value of [prefix][crate::model::ListFoldersRequest::prefix].
        pub fn set_prefix<T: Into<std::string::String>>(mut self, v: T) -> Self {
            self.0.request.prefix = v.into();
            self
        }

        /// Sets the value of [delimiter][crate::model::ListFoldersRequest::delimiter].
        pub fn set_delimiter<T: Into<std::string::String>>(mut self, v: T) -> Self {
            self.0.request.delimiter = v.into();
            self
        }

        /// Sets the value of [lexicographic_start][crate::model::ListFoldersRequest::lexicographic_start].
        pub fn set_lexicographic_start<T: Into<std::string::String>>(mut self, v: T) -> Self {
            self.0.request.lexicographic_start = v.into();
            self
        }

        /// Sets the value of [lexicographic_end][crate::model::ListFoldersRequest::lexicographic_end].
        pub fn set_lexicographic_end<T: Into<std::string::String>>(mut self, v: T) -> Self {
            self.0.request.lexicographic_end = v.into();
            self
        }

        /// Sets the value of [request_id][crate::model::ListFoldersRequest::request_id].
        pub fn set_request_id<T: Into<std::string::String>>(mut self, v: T) -> Self {
            self.0.request.request_id = v.into();
            self
        }
    }

    #[doc(hidden)]
    impl gax::options::internal::RequestBuilder for ListFolders {
        fn request_options(&mut self) -> &mut gax::options::RequestOptions {
            &mut self.0.options
        }
    }

    /// The request builder for [StorageControl::rename_folder][crate::client::StorageControl::rename_folder] calls.
    ///
    /// # Example
    /// ```no_run
    /// # use google_cloud_storage::builder;
    /// use builder::storage_control::RenameFolder;
    /// # tokio_test::block_on(async {
    /// use lro::Poller;
    ///
    /// let builder = prepare_request_builder();
    /// let response = builder.poller().until_done().await?;
    /// # gax::Result::<()>::Ok(()) });
    ///
    /// fn prepare_request_builder() -> RenameFolder {
    ///   # panic!();
    ///   // ... details omitted ...
    /// }
    /// ```
    #[derive(Clone, Debug)]
    pub struct RenameFolder(RequestBuilder<crate::model::RenameFolderRequest>);

    impl RenameFolder {
        pub(crate) fn new(
            stub: std::sync::Arc<dyn super::super::stub::dynamic::StorageControl>,
        ) -> Self {
            Self(RequestBuilder::new(stub))
        }

        /// Sets the full request, replacing any prior values.
        pub fn with_request<V: Into<crate::model::RenameFolderRequest>>(mut self, v: V) -> Self {
            self.0.request = v.into();
            self
        }

        /// Sets all the options, replacing any prior values.
        pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
            self.0.options = v.into();
            self
        }

        /// Sends the request.
        ///
        /// # Long running operations
        ///
        /// This starts, but does not poll, a longrunning operation. More information
        /// on [rename_folder][crate::client::StorageControl::rename_folder].
        pub async fn send(self) -> Result<longrunning::model::Operation> {
            let req = Self::auto_populate(self.0.request, false);
            (*self.0.stub)
                .rename_folder(req, self.0.options)
                .await
                .map(gax::response::Response::into_body)
        }

        /// Creates a [Poller][lro::Poller] to work with `rename_folder`.
        pub fn poller(
            self,
        ) -> impl lro::Poller<crate::model::Folder, crate::model::RenameFolderMetadata> {
            type Operation =
                lro::internal::Operation<crate::model::Folder, crate::model::RenameFolderMetadata>;
            let polling_error_policy = self.0.stub.get_polling_error_policy(&self.0.options);
            let polling_backoff_policy = self.0.stub.get_polling_backoff_policy(&self.0.options);

            let stub = self.0.stub.clone();
            let mut options = self.0.options.clone();
            options.set_retry_policy(gax::retry_policy::NeverRetry);
            let query = move |name| {
                let stub = stub.clone();
                let options = options.clone();
                async {
                    let op = GetOperation::new(stub)
                        .set_name(name)
                        .with_options(options)
                        .send()
                        .await?;
                    Ok(Operation::new(op))
                }
            };

            let start = move || async {
                let op = self.send().await?;
                Ok(Operation::new(op))
            };

            lro::internal::new_poller(polling_error_policy, polling_backoff_policy, start, query)
        }

        fn auto_populate(
            mut req: crate::model::RenameFolderRequest,
            force: bool,
        ) -> crate::model::RenameFolderRequest {
            if force || req.request_id.is_empty() {
                req = req.set_request_id(uuid::Uuid::new_v4().to_string())
            }
            req
        }

        /// Sets the value of [name][crate::model::RenameFolderRequest::name].
        ///
        /// This is a **required** field for requests.
        pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
            self.0.request.name = v.into();
            self
        }

        /// Sets the value of [destination_folder_id][crate::model::RenameFolderRequest::destination_folder_id].
        ///
        /// This is a **required** field for requests.
        pub fn set_destination_folder_id<T: Into<std::string::String>>(mut self, v: T) -> Self {
            self.0.request.destination_folder_id = v.into();
            self
        }

        /// Sets the value of [if_metageneration_match][crate::model::RenameFolderRequest::if_metageneration_match].
        pub fn set_if_metageneration_match<T>(mut self, v: T) -> Self
        where
            T: std::convert::Into<i64>,
        {
            self.0.request.if_metageneration_match = std::option::Option::Some(v.into());
            self
        }

        /// Sets or clears the value of [if_metageneration_match][crate::model::RenameFolderRequest::if_metageneration_match].
        pub fn set_or_clear_if_metageneration_match<T>(mut self, v: std::option::Option<T>) -> Self
        where
            T: std::convert::Into<i64>,
        {
            self.0.request.if_metageneration_match = v.map(|x| x.into());
            self
        }

        /// Sets the value of [if_metageneration_not_match][crate::model::RenameFolderRequest::if_metageneration_not_match].
        pub fn set_if_metageneration_not_match<T>(mut self, v: T) -> Self
        where
            T: std::convert::Into<i64>,
        {
            self.0.request.if_metageneration_not_match = std::option::Option::Some(v.into());
            self
        }

        /// Sets or clears the value of [if_metageneration_not_match][crate::model::RenameFolderRequest::if_metageneration_not_match].
        pub fn set_or_clear_if_metageneration_not_match<T>(
            mut self,
            v: std::option::Option<T>,
        ) -> Self
        where
            T: std::convert::Into<i64>,
        {
            self.0.request.if_metageneration_not_match = v.map(|x| x.into());
            self
        }

        /// Sets the value of [request_id][crate::model::RenameFolderRequest::request_id].
        pub fn set_request_id<T: Into<std::string::String>>(mut self, v: T) -> Self {
            self.0.request.request_id = v.into();
            self
        }
    }

    #[doc(hidden)]
    impl gax::options::internal::RequestBuilder for RenameFolder {
        fn request_options(&mut self) -> &mut gax::options::RequestOptions {
            &mut self.0.options
        }
    }

    /// The request builder for [StorageControl::get_storage_layout][crate::client::StorageControl::get_storage_layout] calls.
    ///
    /// # Example
    /// ```no_run
    /// # use google_cloud_storage::builder;
    /// use builder::storage_control::GetStorageLayout;
    /// # tokio_test::block_on(async {
    ///
    /// let builder = prepare_request_builder();
    /// let response = builder.send().await?;
    /// # gax::Result::<()>::Ok(()) });
    ///
    /// fn prepare_request_builder() -> GetStorageLayout {
    ///   # panic!();
    ///   // ... details omitted ...
    /// }
    /// ```
    #[derive(Clone, Debug)]
    pub struct GetStorageLayout(RequestBuilder<crate::model::GetStorageLayoutRequest>);

    impl GetStorageLayout {
        pub(crate) fn new(
            stub: std::sync::Arc<dyn super::super::stub::dynamic::StorageControl>,
        ) -> Self {
            Self(RequestBuilder::new(stub))
        }

        /// Sets the full request, replacing any prior values.
        pub fn with_request<V: Into<crate::model::GetStorageLayoutRequest>>(
            mut self,
            v: V,
        ) -> Self {
            self.0.request = v.into();
            self
        }

        /// Sets all the options, replacing any prior values.
        pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
            self.0.options = v.into();
            self
        }

        /// Sends the request.
        pub async fn send(self) -> Result<crate::model::StorageLayout> {
            let req = Self::auto_populate(self.0.request, false);
            (*self.0.stub)
                .get_storage_layout(req, self.0.options)
                .await
                .map(gax::response::Response::into_body)
        }

        fn auto_populate(
            mut req: crate::model::GetStorageLayoutRequest,
            force: bool,
        ) -> crate::model::GetStorageLayoutRequest {
            if force || req.request_id.is_empty() {
                req = req.set_request_id(uuid::Uuid::new_v4().to_string())
            }
            req
        }

        /// Sets the value of [name][crate::model::GetStorageLayoutRequest::name].
        ///
        /// This is a **required** field for requests.
        pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
            self.0.request.name = v.into();
            self
        }

        /// Sets the value of [prefix][crate::model::GetStorageLayoutRequest::prefix].
        pub fn set_prefix<T: Into<std::string::String>>(mut self, v: T) -> Self {
            self.0.request.prefix = v.into();
            self
        }

        /// Sets the value of [request_id][crate::model::GetStorageLayoutRequest::request_id].
        pub fn set_request_id<T: Into<std::string::String>>(mut self, v: T) -> Self {
            self.0.request.request_id = v.into();
            self
        }
    }

    #[doc(hidden)]
    impl gax::options::internal::RequestBuilder for GetStorageLayout {
        fn request_options(&mut self) -> &mut gax::options::RequestOptions {
            &mut self.0.options
        }
    }

    /// The request builder for [StorageControl::create_managed_folder][crate::client::StorageControl::create_managed_folder] calls.
    ///
    /// # Example
    /// ```no_run
    /// # use google_cloud_storage::builder;
    /// use builder::storage_control::CreateManagedFolder;
    /// # tokio_test::block_on(async {
    ///
    /// let builder = prepare_request_builder();
    /// let response = builder.send().await?;
    /// # gax::Result::<()>::Ok(()) });
    ///
    /// fn prepare_request_builder() -> CreateManagedFolder {
    ///   # panic!();
    ///   // ... details omitted ...
    /// }
    /// ```
    #[derive(Clone, Debug)]
    pub struct CreateManagedFolder(RequestBuilder<crate::model::CreateManagedFolderRequest>);

    impl CreateManagedFolder {
        pub(crate) fn new(
            stub: std::sync::Arc<dyn super::super::stub::dynamic::StorageControl>,
        ) -> Self {
            Self(RequestBuilder::new(stub))
        }

        /// Sets the full request, replacing any prior values.
        pub fn with_request<V: Into<crate::model::CreateManagedFolderRequest>>(
            mut self,
            v: V,
        ) -> Self {
            self.0.request = v.into();
            self
        }

        /// Sets all the options, replacing any prior values.
        pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
            self.0.options = v.into();
            self
        }

        /// Sends the request.
        pub async fn send(self) -> Result<crate::model::ManagedFolder> {
            let req = Self::auto_populate(self.0.request, false);
            (*self.0.stub)
                .create_managed_folder(req, self.0.options)
                .await
                .map(gax::response::Response::into_body)
        }

        fn auto_populate(
            mut req: crate::model::CreateManagedFolderRequest,
            force: bool,
        ) -> crate::model::CreateManagedFolderRequest {
            if force || req.request_id.is_empty() {
                req = req.set_request_id(uuid::Uuid::new_v4().to_string())
            }
            req
        }

        /// Sets the value of [parent][crate::model::CreateManagedFolderRequest::parent].
        ///
        /// This is a **required** field for requests.
        pub fn set_parent<T: Into<std::string::String>>(mut self, v: T) -> Self {
            self.0.request.parent = v.into();
            self
        }

        /// Sets the value of [managed_folder][crate::model::CreateManagedFolderRequest::managed_folder].
        ///
        /// This is a **required** field for requests.
        pub fn set_managed_folder<T>(mut self, v: T) -> Self
        where
            T: std::convert::Into<crate::model::ManagedFolder>,
        {
            self.0.request.managed_folder = std::option::Option::Some(v.into());
            self
        }

        /// Sets or clears the value of [managed_folder][crate::model::CreateManagedFolderRequest::managed_folder].
        ///
        /// This is a **required** field for requests.
        pub fn set_or_clear_managed_folder<T>(mut self, v: std::option::Option<T>) -> Self
        where
            T: std::convert::Into<crate::model::ManagedFolder>,
        {
            self.0.request.managed_folder = v.map(|x| x.into());
            self
        }

        /// Sets the value of [managed_folder_id][crate::model::CreateManagedFolderRequest::managed_folder_id].
        ///
        /// This is a **required** field for requests.
        pub fn set_managed_folder_id<T: Into<std::string::String>>(mut self, v: T) -> Self {
            self.0.request.managed_folder_id = v.into();
            self
        }

        /// Sets the value of [request_id][crate::model::CreateManagedFolderRequest::request_id].
        pub fn set_request_id<T: Into<std::string::String>>(mut self, v: T) -> Self {
            self.0.request.request_id = v.into();
            self
        }
    }

    #[doc(hidden)]
    impl gax::options::internal::RequestBuilder for CreateManagedFolder {
        fn request_options(&mut self) -> &mut gax::options::RequestOptions {
            &mut self.0.options
        }
    }

    /// The request builder for [StorageControl::delete_managed_folder][crate::client::StorageControl::delete_managed_folder] calls.
    ///
    /// # Example
    /// ```no_run
    /// # use google_cloud_storage::builder;
    /// use builder::storage_control::DeleteManagedFolder;
    /// # tokio_test::block_on(async {
    ///
    /// let builder = prepare_request_builder();
    /// let response = builder.send().await?;
    /// # gax::Result::<()>::Ok(()) });
    ///
    /// fn prepare_request_builder() -> DeleteManagedFolder {
    ///   # panic!();
    ///   // ... details omitted ...
    /// }
    /// ```
    #[derive(Clone, Debug)]
    pub struct DeleteManagedFolder(RequestBuilder<crate::model::DeleteManagedFolderRequest>);

    impl DeleteManagedFolder {
        pub(crate) fn new(
            stub: std::sync::Arc<dyn super::super::stub::dynamic::StorageControl>,
        ) -> Self {
            Self(RequestBuilder::new(stub))
        }

        /// Sets the full request, replacing any prior values.
        pub fn with_request<V: Into<crate::model::DeleteManagedFolderRequest>>(
            mut self,
            v: V,
        ) -> Self {
            self.0.request = v.into();
            self
        }

        /// Sets all the options, replacing any prior values.
        pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
            self.0.options = v.into();
            self
        }

        /// Sends the request.
        pub async fn send(self) -> Result<()> {
            let req = Self::auto_populate(self.0.request, false);
            (*self.0.stub)
                .delete_managed_folder(req, self.0.options)
                .await
                .map(gax::response::Response::into_body)
        }

        fn auto_populate(
            mut req: crate::model::DeleteManagedFolderRequest,
            force: bool,
        ) -> crate::model::DeleteManagedFolderRequest {
            if force || req.request_id.is_empty() {
                req = req.set_request_id(uuid::Uuid::new_v4().to_string())
            }
            req
        }

        /// Sets the value of [name][crate::model::DeleteManagedFolderRequest::name].
        ///
        /// This is a **required** field for requests.
        pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
            self.0.request.name = v.into();
            self
        }

        /// Sets the value of [if_metageneration_match][crate::model::DeleteManagedFolderRequest::if_metageneration_match].
        pub fn set_if_metageneration_match<T>(mut self, v: T) -> Self
        where
            T: std::convert::Into<i64>,
        {
            self.0.request.if_metageneration_match = std::option::Option::Some(v.into());
            self
        }

        /// Sets or clears the value of [if_metageneration_match][crate::model::DeleteManagedFolderRequest::if_metageneration_match].
        pub fn set_or_clear_if_metageneration_match<T>(mut self, v: std::option::Option<T>) -> Self
        where
            T: std::convert::Into<i64>,
        {
            self.0.request.if_metageneration_match = v.map(|x| x.into());
            self
        }

        /// Sets the value of [if_metageneration_not_match][crate::model::DeleteManagedFolderRequest::if_metageneration_not_match].
        pub fn set_if_metageneration_not_match<T>(mut self, v: T) -> Self
        where
            T: std::convert::Into<i64>,
        {
            self.0.request.if_metageneration_not_match = std::option::Option::Some(v.into());
            self
        }

        /// Sets or clears the value of [if_metageneration_not_match][crate::model::DeleteManagedFolderRequest::if_metageneration_not_match].
        pub fn set_or_clear_if_metageneration_not_match<T>(
            mut self,
            v: std::option::Option<T>,
        ) -> Self
        where
            T: std::convert::Into<i64>,
        {
            self.0.request.if_metageneration_not_match = v.map(|x| x.into());
            self
        }

        /// Sets the value of [allow_non_empty][crate::model::DeleteManagedFolderRequest::allow_non_empty].
        pub fn set_allow_non_empty<T: Into<bool>>(mut self, v: T) -> Self {
            self.0.request.allow_non_empty = v.into();
            self
        }

        /// Sets the value of [request_id][crate::model::DeleteManagedFolderRequest::request_id].
        pub fn set_request_id<T: Into<std::string::String>>(mut self, v: T) -> Self {
            self.0.request.request_id = v.into();
            self
        }
    }

    #[doc(hidden)]
    impl gax::options::internal::RequestBuilder for DeleteManagedFolder {
        fn request_options(&mut self) -> &mut gax::options::RequestOptions {
            &mut self.0.options
        }
    }

    /// The request builder for [StorageControl::get_managed_folder][crate::client::StorageControl::get_managed_folder] calls.
    ///
    /// # Example
    /// ```no_run
    /// # use google_cloud_storage::builder;
    /// use builder::storage_control::GetManagedFolder;
    /// # tokio_test::block_on(async {
    ///
    /// let builder = prepare_request_builder();
    /// let response = builder.send().await?;
    /// # gax::Result::<()>::Ok(()) });
    ///
    /// fn prepare_request_builder() -> GetManagedFolder {
    ///   # panic!();
    ///   // ... details omitted ...
    /// }
    /// ```
    #[derive(Clone, Debug)]
    pub struct GetManagedFolder(RequestBuilder<crate::model::GetManagedFolderRequest>);

    impl GetManagedFolder {
        pub(crate) fn new(
            stub: std::sync::Arc<dyn super::super::stub::dynamic::StorageControl>,
        ) -> Self {
            Self(RequestBuilder::new(stub))
        }

        /// Sets the full request, replacing any prior values.
        pub fn with_request<V: Into<crate::model::GetManagedFolderRequest>>(
            mut self,
            v: V,
        ) -> Self {
            self.0.request = v.into();
            self
        }

        /// Sets all the options, replacing any prior values.
        pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
            self.0.options = v.into();
            self
        }

        /// Sends the request.
        pub async fn send(self) -> Result<crate::model::ManagedFolder> {
            let req = Self::auto_populate(self.0.request, false);
            (*self.0.stub)
                .get_managed_folder(req, self.0.options)
                .await
                .map(gax::response::Response::into_body)
        }

        fn auto_populate(
            mut req: crate::model::GetManagedFolderRequest,
            force: bool,
        ) -> crate::model::GetManagedFolderRequest {
            if force || req.request_id.is_empty() {
                req = req.set_request_id(uuid::Uuid::new_v4().to_string())
            }
            req
        }

        /// Sets the value of [name][crate::model::GetManagedFolderRequest::name].
        ///
        /// This is a **required** field for requests.
        pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
            self.0.request.name = v.into();
            self
        }

        /// Sets the value of [if_metageneration_match][crate::model::GetManagedFolderRequest::if_metageneration_match].
        pub fn set_if_metageneration_match<T>(mut self, v: T) -> Self
        where
            T: std::convert::Into<i64>,
        {
            self.0.request.if_metageneration_match = std::option::Option::Some(v.into());
            self
        }

        /// Sets or clears the value of [if_metageneration_match][crate::model::GetManagedFolderRequest::if_metageneration_match].
        pub fn set_or_clear_if_metageneration_match<T>(mut self, v: std::option::Option<T>) -> Self
        where
            T: std::convert::Into<i64>,
        {
            self.0.request.if_metageneration_match = v.map(|x| x.into());
            self
        }

        /// Sets the value of [if_metageneration_not_match][crate::model::GetManagedFolderRequest::if_metageneration_not_match].
        pub fn set_if_metageneration_not_match<T>(mut self, v: T) -> Self
        where
            T: std::convert::Into<i64>,
        {
            self.0.request.if_metageneration_not_match = std::option::Option::Some(v.into());
            self
        }

        /// Sets or clears the value of [if_metageneration_not_match][crate::model::GetManagedFolderRequest::if_metageneration_not_match].
        pub fn set_or_clear_if_metageneration_not_match<T>(
            mut self,
            v: std::option::Option<T>,
        ) -> Self
        where
            T: std::convert::Into<i64>,
        {
            self.0.request.if_metageneration_not_match = v.map(|x| x.into());
            self
        }

        /// Sets the value of [request_id][crate::model::GetManagedFolderRequest::request_id].
        pub fn set_request_id<T: Into<std::string::String>>(mut self, v: T) -> Self {
            self.0.request.request_id = v.into();
            self
        }
    }

    #[doc(hidden)]
    impl gax::options::internal::RequestBuilder for GetManagedFolder {
        fn request_options(&mut self) -> &mut gax::options::RequestOptions {
            &mut self.0.options
        }
    }

    /// The request builder for [StorageControl::list_managed_folders][crate::client::StorageControl::list_managed_folders] calls.
    ///
    /// # Example
    /// ```no_run
    /// # use google_cloud_storage::builder;
    /// use builder::storage_control::ListManagedFolders;
    /// # tokio_test::block_on(async {
    /// use gax::paginator::ItemPaginator;
    ///
    /// let builder = prepare_request_builder();
    /// let mut items = builder.by_item();
    /// while let Some(result) = items.next().await {
    ///   let item = result?;
    /// }
    /// # gax::Result::<()>::Ok(()) });
    ///
    /// fn prepare_request_builder() -> ListManagedFolders {
    ///   # panic!();
    ///   // ... details omitted ...
    /// }
    /// ```
    #[derive(Clone, Debug)]
    pub struct ListManagedFolders(RequestBuilder<crate::model::ListManagedFoldersRequest>);

    impl ListManagedFolders {
        pub(crate) fn new(
            stub: std::sync::Arc<dyn super::super::stub::dynamic::StorageControl>,
        ) -> Self {
            Self(RequestBuilder::new(stub))
        }

        /// Sets the full request, replacing any prior values.
        pub fn with_request<V: Into<crate::model::ListManagedFoldersRequest>>(
            mut self,
            v: V,
        ) -> Self {
            self.0.request = v.into();
            self
        }

        /// Sets all the options, replacing any prior values.
        pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
            self.0.options = v.into();
            self
        }

        /// Sends the request.
        pub async fn send(self) -> Result<crate::model::ListManagedFoldersResponse> {
            let req = Self::auto_populate(self.0.request, false);
            (*self.0.stub)
                .list_managed_folders(req, self.0.options)
                .await
                .map(gax::response::Response::into_body)
        }

        /// Streams each page in the collection.
        pub fn by_page(
            self,
        ) -> impl gax::paginator::Paginator<crate::model::ListManagedFoldersResponse, gax::error::Error>
        {
            use std::clone::Clone;
            let token = self.0.request.page_token.clone();
            let execute = move |token: String| {
                let mut builder = self.clone();
                let initial = builder.0.request.page_token == token;
                builder.0.request = Self::auto_populate(builder.0.request, !initial);
                builder.0.request = builder.0.request.set_page_token(token);
                builder.send()
            };
            gax::paginator::internal::new_paginator(token, execute)
        }

        /// Streams each item in the collection.
        pub fn by_item(
            self,
        ) -> impl gax::paginator::ItemPaginator<
            crate::model::ListManagedFoldersResponse,
            gax::error::Error,
        > {
            use gax::paginator::Paginator;
            self.by_page().items()
        }

        fn auto_populate(
            mut req: crate::model::ListManagedFoldersRequest,
            force: bool,
        ) -> crate::model::ListManagedFoldersRequest {
            if force || req.request_id.is_empty() {
                req = req.set_request_id(uuid::Uuid::new_v4().to_string())
            }
            req
        }

        /// Sets the value of [parent][crate::model::ListManagedFoldersRequest::parent].
        ///
        /// This is a **required** field for requests.
        pub fn set_parent<T: Into<std::string::String>>(mut self, v: T) -> Self {
            self.0.request.parent = v.into();
            self
        }

        /// Sets the value of [page_size][crate::model::ListManagedFoldersRequest::page_size].
        pub fn set_page_size<T: Into<i32>>(mut self, v: T) -> Self {
            self.0.request.page_size = v.into();
            self
        }

        /// Sets the value of [page_token][crate::model::ListManagedFoldersRequest::page_token].
        pub fn set_page_token<T: Into<std::string::String>>(mut self, v: T) -> Self {
            self.0.request.page_token = v.into();
            self
        }

        /// Sets the value of [prefix][crate::model::ListManagedFoldersRequest::prefix].
        pub fn set_prefix<T: Into<std::string::String>>(mut self, v: T) -> Self {
            self.0.request.prefix = v.into();
            self
        }

        /// Sets the value of [request_id][crate::model::ListManagedFoldersRequest::request_id].
        pub fn set_request_id<T: Into<std::string::String>>(mut self, v: T) -> Self {
            self.0.request.request_id = v.into();
            self
        }
    }

    #[doc(hidden)]
    impl gax::options::internal::RequestBuilder for ListManagedFolders {
        fn request_options(&mut self) -> &mut gax::options::RequestOptions {
            &mut self.0.options
        }
    }

    /// The request builder for [StorageControl::create_anywhere_cache][crate::client::StorageControl::create_anywhere_cache] calls.
    ///
    /// # Example
    /// ```no_run
    /// # use google_cloud_storage::builder;
    /// use builder::storage_control::CreateAnywhereCache;
    /// # tokio_test::block_on(async {
    /// use lro::Poller;
    ///
    /// let builder = prepare_request_builder();
    /// let response = builder.poller().until_done().await?;
    /// # gax::Result::<()>::Ok(()) });
    ///
    /// fn prepare_request_builder() -> CreateAnywhereCache {
    ///   # panic!();
    ///   // ... details omitted ...
    /// }
    /// ```
    #[derive(Clone, Debug)]
    pub struct CreateAnywhereCache(RequestBuilder<crate::model::CreateAnywhereCacheRequest>);

    impl CreateAnywhereCache {
        pub(crate) fn new(
            stub: std::sync::Arc<dyn super::super::stub::dynamic::StorageControl>,
        ) -> Self {
            Self(RequestBuilder::new(stub))
        }

        /// Sets the full request, replacing any prior values.
        pub fn with_request<V: Into<crate::model::CreateAnywhereCacheRequest>>(
            mut self,
            v: V,
        ) -> Self {
            self.0.request = v.into();
            self
        }

        /// Sets all the options, replacing any prior values.
        pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
            self.0.options = v.into();
            self
        }

        /// Sends the request.
        ///
        /// # Long running operations
        ///
        /// This starts, but does not poll, a longrunning operation. More information
        /// on [create_anywhere_cache][crate::client::StorageControl::create_anywhere_cache].
        pub async fn send(self) -> Result<longrunning::model::Operation> {
            let req = Self::auto_populate(self.0.request, false);
            (*self.0.stub)
                .create_anywhere_cache(req, self.0.options)
                .await
                .map(gax::response::Response::into_body)
        }

        /// Creates a [Poller][lro::Poller] to work with `create_anywhere_cache`.
        pub fn poller(
            self,
        ) -> impl lro::Poller<crate::model::AnywhereCache, crate::model::CreateAnywhereCacheMetadata>
        {
            type Operation = lro::internal::Operation<
                crate::model::AnywhereCache,
                crate::model::CreateAnywhereCacheMetadata,
            >;
            let polling_error_policy = self.0.stub.get_polling_error_policy(&self.0.options);
            let polling_backoff_policy = self.0.stub.get_polling_backoff_policy(&self.0.options);

            let stub = self.0.stub.clone();
            let mut options = self.0.options.clone();
            options.set_retry_policy(gax::retry_policy::NeverRetry);
            let query = move |name| {
                let stub = stub.clone();
                let options = options.clone();
                async {
                    let op = GetOperation::new(stub)
                        .set_name(name)
                        .with_options(options)
                        .send()
                        .await?;
                    Ok(Operation::new(op))
                }
            };

            let start = move || async {
                let op = self.send().await?;
                Ok(Operation::new(op))
            };

            lro::internal::new_poller(polling_error_policy, polling_backoff_policy, start, query)
        }

        fn auto_populate(
            mut req: crate::model::CreateAnywhereCacheRequest,
            force: bool,
        ) -> crate::model::CreateAnywhereCacheRequest {
            if force || req.request_id.is_empty() {
                req = req.set_request_id(uuid::Uuid::new_v4().to_string())
            }
            req
        }

        /// Sets the value of [parent][crate::model::CreateAnywhereCacheRequest::parent].
        ///
        /// This is a **required** field for requests.
        pub fn set_parent<T: Into<std::string::String>>(mut self, v: T) -> Self {
            self.0.request.parent = v.into();
            self
        }

        /// Sets the value of [anywhere_cache][crate::model::CreateAnywhereCacheRequest::anywhere_cache].
        ///
        /// This is a **required** field for requests.
        pub fn set_anywhere_cache<T>(mut self, v: T) -> Self
        where
            T: std::convert::Into<crate::model::AnywhereCache>,
        {
            self.0.request.anywhere_cache = std::option::Option::Some(v.into());
            self
        }

        /// Sets or clears the value of [anywhere_cache][crate::model::CreateAnywhereCacheRequest::anywhere_cache].
        ///
        /// This is a **required** field for requests.
        pub fn set_or_clear_anywhere_cache<T>(mut self, v: std::option::Option<T>) -> Self
        where
            T: std::convert::Into<crate::model::AnywhereCache>,
        {
            self.0.request.anywhere_cache = v.map(|x| x.into());
            self
        }

        /// Sets the value of [request_id][crate::model::CreateAnywhereCacheRequest::request_id].
        pub fn set_request_id<T: Into<std::string::String>>(mut self, v: T) -> Self {
            self.0.request.request_id = v.into();
            self
        }
    }

    #[doc(hidden)]
    impl gax::options::internal::RequestBuilder for CreateAnywhereCache {
        fn request_options(&mut self) -> &mut gax::options::RequestOptions {
            &mut self.0.options
        }
    }

    /// The request builder for [StorageControl::update_anywhere_cache][crate::client::StorageControl::update_anywhere_cache] calls.
    ///
    /// # Example
    /// ```no_run
    /// # use google_cloud_storage::builder;
    /// use builder::storage_control::UpdateAnywhereCache;
    /// # tokio_test::block_on(async {
    /// use lro::Poller;
    ///
    /// let builder = prepare_request_builder();
    /// let response = builder.poller().until_done().await?;
    /// # gax::Result::<()>::Ok(()) });
    ///
    /// fn prepare_request_builder() -> UpdateAnywhereCache {
    ///   # panic!();
    ///   // ... details omitted ...
    /// }
    /// ```
    #[derive(Clone, Debug)]
    pub struct UpdateAnywhereCache(RequestBuilder<crate::model::UpdateAnywhereCacheRequest>);

    impl UpdateAnywhereCache {
        pub(crate) fn new(
            stub: std::sync::Arc<dyn super::super::stub::dynamic::StorageControl>,
        ) -> Self {
            Self(RequestBuilder::new(stub))
        }

        /// Sets the full request, replacing any prior values.
        pub fn with_request<V: Into<crate::model::UpdateAnywhereCacheRequest>>(
            mut self,
            v: V,
        ) -> Self {
            self.0.request = v.into();
            self
        }

        /// Sets all the options, replacing any prior values.
        pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
            self.0.options = v.into();
            self
        }

        /// Sends the request.
        ///
        /// # Long running operations
        ///
        /// This starts, but does not poll, a longrunning operation. More information
        /// on [update_anywhere_cache][crate::client::StorageControl::update_anywhere_cache].
        pub async fn send(self) -> Result<longrunning::model::Operation> {
            let req = Self::auto_populate(self.0.request, false);
            (*self.0.stub)
                .update_anywhere_cache(req, self.0.options)
                .await
                .map(gax::response::Response::into_body)
        }

        /// Creates a [Poller][lro::Poller] to work with `update_anywhere_cache`.
        pub fn poller(
            self,
        ) -> impl lro::Poller<crate::model::AnywhereCache, crate::model::UpdateAnywhereCacheMetadata>
        {
            type Operation = lro::internal::Operation<
                crate::model::AnywhereCache,
                crate::model::UpdateAnywhereCacheMetadata,
            >;
            let polling_error_policy = self.0.stub.get_polling_error_policy(&self.0.options);
            let polling_backoff_policy = self.0.stub.get_polling_backoff_policy(&self.0.options);

            let stub = self.0.stub.clone();
            let mut options = self.0.options.clone();
            options.set_retry_policy(gax::retry_policy::NeverRetry);
            let query = move |name| {
                let stub = stub.clone();
                let options = options.clone();
                async {
                    let op = GetOperation::new(stub)
                        .set_name(name)
                        .with_options(options)
                        .send()
                        .await?;
                    Ok(Operation::new(op))
                }
            };

            let start = move || async {
                let op = self.send().await?;
                Ok(Operation::new(op))
            };

            lro::internal::new_poller(polling_error_policy, polling_backoff_policy, start, query)
        }

        fn auto_populate(
            mut req: crate::model::UpdateAnywhereCacheRequest,
            force: bool,
        ) -> crate::model::UpdateAnywhereCacheRequest {
            if force || req.request_id.is_empty() {
                req = req.set_request_id(uuid::Uuid::new_v4().to_string())
            }
            req
        }

        /// Sets the value of [anywhere_cache][crate::model::UpdateAnywhereCacheRequest::anywhere_cache].
        ///
        /// This is a **required** field for requests.
        pub fn set_anywhere_cache<T>(mut self, v: T) -> Self
        where
            T: std::convert::Into<crate::model::AnywhereCache>,
        {
            self.0.request.anywhere_cache = std::option::Option::Some(v.into());
            self
        }

        /// Sets or clears the value of [anywhere_cache][crate::model::UpdateAnywhereCacheRequest::anywhere_cache].
        ///
        /// This is a **required** field for requests.
        pub fn set_or_clear_anywhere_cache<T>(mut self, v: std::option::Option<T>) -> Self
        where
            T: std::convert::Into<crate::model::AnywhereCache>,
        {
            self.0.request.anywhere_cache = v.map(|x| x.into());
            self
        }

        /// Sets the value of [update_mask][crate::model::UpdateAnywhereCacheRequest::update_mask].
        ///
        /// This is a **required** field for requests.
        pub fn set_update_mask<T>(mut self, v: T) -> Self
        where
            T: std::convert::Into<wkt::FieldMask>,
        {
            self.0.request.update_mask = std::option::Option::Some(v.into());
            self
        }

        /// Sets or clears the value of [update_mask][crate::model::UpdateAnywhereCacheRequest::update_mask].
        ///
        /// This is a **required** field for requests.
        pub fn set_or_clear_update_mask<T>(mut self, v: std::option::Option<T>) -> Self
        where
            T: std::convert::Into<wkt::FieldMask>,
        {
            self.0.request.update_mask = v.map(|x| x.into());
            self
        }

        /// Sets the value of [request_id][crate::model::UpdateAnywhereCacheRequest::request_id].
        pub fn set_request_id<T: Into<std::string::String>>(mut self, v: T) -> Self {
            self.0.request.request_id = v.into();
            self
        }
    }

    #[doc(hidden)]
    impl gax::options::internal::RequestBuilder for UpdateAnywhereCache {
        fn request_options(&mut self) -> &mut gax::options::RequestOptions {
            &mut self.0.options
        }
    }

    /// The request builder for [StorageControl::disable_anywhere_cache][crate::client::StorageControl::disable_anywhere_cache] calls.
    ///
    /// # Example
    /// ```no_run
    /// # use google_cloud_storage::builder;
    /// use builder::storage_control::DisableAnywhereCache;
    /// # tokio_test::block_on(async {
    ///
    /// let builder = prepare_request_builder();
    /// let response = builder.send().await?;
    /// # gax::Result::<()>::Ok(()) });
    ///
    /// fn prepare_request_builder() -> DisableAnywhereCache {
    ///   # panic!();
    ///   // ... details omitted ...
    /// }
    /// ```
    #[derive(Clone, Debug)]
    pub struct DisableAnywhereCache(RequestBuilder<crate::model::DisableAnywhereCacheRequest>);

    impl DisableAnywhereCache {
        pub(crate) fn new(
            stub: std::sync::Arc<dyn super::super::stub::dynamic::StorageControl>,
        ) -> Self {
            Self(RequestBuilder::new(stub))
        }

        /// Sets the full request, replacing any prior values.
        pub fn with_request<V: Into<crate::model::DisableAnywhereCacheRequest>>(
            mut self,
            v: V,
        ) -> Self {
            self.0.request = v.into();
            self
        }

        /// Sets all the options, replacing any prior values.
        pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
            self.0.options = v.into();
            self
        }

        /// Sends the request.
        pub async fn send(self) -> Result<crate::model::AnywhereCache> {
            let req = Self::auto_populate(self.0.request, false);
            (*self.0.stub)
                .disable_anywhere_cache(req, self.0.options)
                .await
                .map(gax::response::Response::into_body)
        }

        fn auto_populate(
            mut req: crate::model::DisableAnywhereCacheRequest,
            force: bool,
        ) -> crate::model::DisableAnywhereCacheRequest {
            if force || req.request_id.is_empty() {
                req = req.set_request_id(uuid::Uuid::new_v4().to_string())
            }
            req
        }

        /// Sets the value of [name][crate::model::DisableAnywhereCacheRequest::name].
        ///
        /// This is a **required** field for requests.
        pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
            self.0.request.name = v.into();
            self
        }

        /// Sets the value of [request_id][crate::model::DisableAnywhereCacheRequest::request_id].
        pub fn set_request_id<T: Into<std::string::String>>(mut self, v: T) -> Self {
            self.0.request.request_id = v.into();
            self
        }
    }

    #[doc(hidden)]
    impl gax::options::internal::RequestBuilder for DisableAnywhereCache {
        fn request_options(&mut self) -> &mut gax::options::RequestOptions {
            &mut self.0.options
        }
    }

    /// The request builder for [StorageControl::pause_anywhere_cache][crate::client::StorageControl::pause_anywhere_cache] calls.
    ///
    /// # Example
    /// ```no_run
    /// # use google_cloud_storage::builder;
    /// use builder::storage_control::PauseAnywhereCache;
    /// # tokio_test::block_on(async {
    ///
    /// let builder = prepare_request_builder();
    /// let response = builder.send().await?;
    /// # gax::Result::<()>::Ok(()) });
    ///
    /// fn prepare_request_builder() -> PauseAnywhereCache {
    ///   # panic!();
    ///   // ... details omitted ...
    /// }
    /// ```
    #[derive(Clone, Debug)]
    pub struct PauseAnywhereCache(RequestBuilder<crate::model::PauseAnywhereCacheRequest>);

    impl PauseAnywhereCache {
        pub(crate) fn new(
            stub: std::sync::Arc<dyn super::super::stub::dynamic::StorageControl>,
        ) -> Self {
            Self(RequestBuilder::new(stub))
        }

        /// Sets the full request, replacing any prior values.
        pub fn with_request<V: Into<crate::model::PauseAnywhereCacheRequest>>(
            mut self,
            v: V,
        ) -> Self {
            self.0.request = v.into();
            self
        }

        /// Sets all the options, replacing any prior values.
        pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
            self.0.options = v.into();
            self
        }

        /// Sends the request.
        pub async fn send(self) -> Result<crate::model::AnywhereCache> {
            let req = Self::auto_populate(self.0.request, false);
            (*self.0.stub)
                .pause_anywhere_cache(req, self.0.options)
                .await
                .map(gax::response::Response::into_body)
        }

        fn auto_populate(
            mut req: crate::model::PauseAnywhereCacheRequest,
            force: bool,
        ) -> crate::model::PauseAnywhereCacheRequest {
            if force || req.request_id.is_empty() {
                req = req.set_request_id(uuid::Uuid::new_v4().to_string())
            }
            req
        }

        /// Sets the value of [name][crate::model::PauseAnywhereCacheRequest::name].
        ///
        /// This is a **required** field for requests.
        pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
            self.0.request.name = v.into();
            self
        }

        /// Sets the value of [request_id][crate::model::PauseAnywhereCacheRequest::request_id].
        pub fn set_request_id<T: Into<std::string::String>>(mut self, v: T) -> Self {
            self.0.request.request_id = v.into();
            self
        }
    }

    #[doc(hidden)]
    impl gax::options::internal::RequestBuilder for PauseAnywhereCache {
        fn request_options(&mut self) -> &mut gax::options::RequestOptions {
            &mut self.0.options
        }
    }

    /// The request builder for [StorageControl::resume_anywhere_cache][crate::client::StorageControl::resume_anywhere_cache] calls.
    ///
    /// # Example
    /// ```no_run
    /// # use google_cloud_storage::builder;
    /// use builder::storage_control::ResumeAnywhereCache;
    /// # tokio_test::block_on(async {
    ///
    /// let builder = prepare_request_builder();
    /// let response = builder.send().await?;
    /// # gax::Result::<()>::Ok(()) });
    ///
    /// fn prepare_request_builder() -> ResumeAnywhereCache {
    ///   # panic!();
    ///   // ... details omitted ...
    /// }
    /// ```
    #[derive(Clone, Debug)]
    pub struct ResumeAnywhereCache(RequestBuilder<crate::model::ResumeAnywhereCacheRequest>);

    impl ResumeAnywhereCache {
        pub(crate) fn new(
            stub: std::sync::Arc<dyn super::super::stub::dynamic::StorageControl>,
        ) -> Self {
            Self(RequestBuilder::new(stub))
        }

        /// Sets the full request, replacing any prior values.
        pub fn with_request<V: Into<crate::model::ResumeAnywhereCacheRequest>>(
            mut self,
            v: V,
        ) -> Self {
            self.0.request = v.into();
            self
        }

        /// Sets all the options, replacing any prior values.
        pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
            self.0.options = v.into();
            self
        }

        /// Sends the request.
        pub async fn send(self) -> Result<crate::model::AnywhereCache> {
            let req = Self::auto_populate(self.0.request, false);
            (*self.0.stub)
                .resume_anywhere_cache(req, self.0.options)
                .await
                .map(gax::response::Response::into_body)
        }

        fn auto_populate(
            mut req: crate::model::ResumeAnywhereCacheRequest,
            force: bool,
        ) -> crate::model::ResumeAnywhereCacheRequest {
            if force || req.request_id.is_empty() {
                req = req.set_request_id(uuid::Uuid::new_v4().to_string())
            }
            req
        }

        /// Sets the value of [name][crate::model::ResumeAnywhereCacheRequest::name].
        ///
        /// This is a **required** field for requests.
        pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
            self.0.request.name = v.into();
            self
        }

        /// Sets the value of [request_id][crate::model::ResumeAnywhereCacheRequest::request_id].
        pub fn set_request_id<T: Into<std::string::String>>(mut self, v: T) -> Self {
            self.0.request.request_id = v.into();
            self
        }
    }

    #[doc(hidden)]
    impl gax::options::internal::RequestBuilder for ResumeAnywhereCache {
        fn request_options(&mut self) -> &mut gax::options::RequestOptions {
            &mut self.0.options
        }
    }

    /// The request builder for [StorageControl::get_anywhere_cache][crate::client::StorageControl::get_anywhere_cache] calls.
    ///
    /// # Example
    /// ```no_run
    /// # use google_cloud_storage::builder;
    /// use builder::storage_control::GetAnywhereCache;
    /// # tokio_test::block_on(async {
    ///
    /// let builder = prepare_request_builder();
    /// let response = builder.send().await?;
    /// # gax::Result::<()>::Ok(()) });
    ///
    /// fn prepare_request_builder() -> GetAnywhereCache {
    ///   # panic!();
    ///   // ... details omitted ...
    /// }
    /// ```
    #[derive(Clone, Debug)]
    pub struct GetAnywhereCache(RequestBuilder<crate::model::GetAnywhereCacheRequest>);

    impl GetAnywhereCache {
        pub(crate) fn new(
            stub: std::sync::Arc<dyn super::super::stub::dynamic::StorageControl>,
        ) -> Self {
            Self(RequestBuilder::new(stub))
        }

        /// Sets the full request, replacing any prior values.
        pub fn with_request<V: Into<crate::model::GetAnywhereCacheRequest>>(
            mut self,
            v: V,
        ) -> Self {
            self.0.request = v.into();
            self
        }

        /// Sets all the options, replacing any prior values.
        pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
            self.0.options = v.into();
            self
        }

        /// Sends the request.
        pub async fn send(self) -> Result<crate::model::AnywhereCache> {
            let req = Self::auto_populate(self.0.request, false);
            (*self.0.stub)
                .get_anywhere_cache(req, self.0.options)
                .await
                .map(gax::response::Response::into_body)
        }

        fn auto_populate(
            mut req: crate::model::GetAnywhereCacheRequest,
            force: bool,
        ) -> crate::model::GetAnywhereCacheRequest {
            if force || req.request_id.is_empty() {
                req = req.set_request_id(uuid::Uuid::new_v4().to_string())
            }
            req
        }

        /// Sets the value of [name][crate::model::GetAnywhereCacheRequest::name].
        ///
        /// This is a **required** field for requests.
        pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
            self.0.request.name = v.into();
            self
        }

        /// Sets the value of [request_id][crate::model::GetAnywhereCacheRequest::request_id].
        pub fn set_request_id<T: Into<std::string::String>>(mut self, v: T) -> Self {
            self.0.request.request_id = v.into();
            self
        }
    }

    #[doc(hidden)]
    impl gax::options::internal::RequestBuilder for GetAnywhereCache {
        fn request_options(&mut self) -> &mut gax::options::RequestOptions {
            &mut self.0.options
        }
    }

    /// The request builder for [StorageControl::list_anywhere_caches][crate::client::StorageControl::list_anywhere_caches] calls.
    ///
    /// # Example
    /// ```no_run
    /// # use google_cloud_storage::builder;
    /// use builder::storage_control::ListAnywhereCaches;
    /// # tokio_test::block_on(async {
    /// use gax::paginator::ItemPaginator;
    ///
    /// let builder = prepare_request_builder();
    /// let mut items = builder.by_item();
    /// while let Some(result) = items.next().await {
    ///   let item = result?;
    /// }
    /// # gax::Result::<()>::Ok(()) });
    ///
    /// fn prepare_request_builder() -> ListAnywhereCaches {
    ///   # panic!();
    ///   // ... details omitted ...
    /// }
    /// ```
    #[derive(Clone, Debug)]
    pub struct ListAnywhereCaches(RequestBuilder<crate::model::ListAnywhereCachesRequest>);

    impl ListAnywhereCaches {
        pub(crate) fn new(
            stub: std::sync::Arc<dyn super::super::stub::dynamic::StorageControl>,
        ) -> Self {
            Self(RequestBuilder::new(stub))
        }

        /// Sets the full request, replacing any prior values.
        pub fn with_request<V: Into<crate::model::ListAnywhereCachesRequest>>(
            mut self,
            v: V,
        ) -> Self {
            self.0.request = v.into();
            self
        }

        /// Sets all the options, replacing any prior values.
        pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
            self.0.options = v.into();
            self
        }

        /// Sends the request.
        pub async fn send(self) -> Result<crate::model::ListAnywhereCachesResponse> {
            let req = Self::auto_populate(self.0.request, false);
            (*self.0.stub)
                .list_anywhere_caches(req, self.0.options)
                .await
                .map(gax::response::Response::into_body)
        }

        /// Streams each page in the collection.
        pub fn by_page(
            self,
        ) -> impl gax::paginator::Paginator<crate::model::ListAnywhereCachesResponse, gax::error::Error>
        {
            use std::clone::Clone;
            let token = self.0.request.page_token.clone();
            let execute = move |token: String| {
                let mut builder = self.clone();
                let initial = builder.0.request.page_token == token;
                builder.0.request = Self::auto_populate(builder.0.request, !initial);
                builder.0.request = builder.0.request.set_page_token(token);
                builder.send()
            };
            gax::paginator::internal::new_paginator(token, execute)
        }

        /// Streams each item in the collection.
        pub fn by_item(
            self,
        ) -> impl gax::paginator::ItemPaginator<
            crate::model::ListAnywhereCachesResponse,
            gax::error::Error,
        > {
            use gax::paginator::Paginator;
            self.by_page().items()
        }

        fn auto_populate(
            mut req: crate::model::ListAnywhereCachesRequest,
            force: bool,
        ) -> crate::model::ListAnywhereCachesRequest {
            if force || req.request_id.is_empty() {
                req = req.set_request_id(uuid::Uuid::new_v4().to_string())
            }
            req
        }

        /// Sets the value of [parent][crate::model::ListAnywhereCachesRequest::parent].
        ///
        /// This is a **required** field for requests.
        pub fn set_parent<T: Into<std::string::String>>(mut self, v: T) -> Self {
            self.0.request.parent = v.into();
            self
        }

        /// Sets the value of [page_size][crate::model::ListAnywhereCachesRequest::page_size].
        pub fn set_page_size<T: Into<i32>>(mut self, v: T) -> Self {
            self.0.request.page_size = v.into();
            self
        }

        /// Sets the value of [page_token][crate::model::ListAnywhereCachesRequest::page_token].
        pub fn set_page_token<T: Into<std::string::String>>(mut self, v: T) -> Self {
            self.0.request.page_token = v.into();
            self
        }

        /// Sets the value of [request_id][crate::model::ListAnywhereCachesRequest::request_id].
        pub fn set_request_id<T: Into<std::string::String>>(mut self, v: T) -> Self {
            self.0.request.request_id = v.into();
            self
        }
    }

    #[doc(hidden)]
    impl gax::options::internal::RequestBuilder for ListAnywhereCaches {
        fn request_options(&mut self) -> &mut gax::options::RequestOptions {
            &mut self.0.options
        }
    }

    /// The request builder for [StorageControl::get_project_intelligence_config][crate::client::StorageControl::get_project_intelligence_config] calls.
    ///
    /// # Example
    /// ```no_run
    /// # use google_cloud_storage::builder;
    /// use builder::storage_control::GetProjectIntelligenceConfig;
    /// # tokio_test::block_on(async {
    ///
    /// let builder = prepare_request_builder();
    /// let response = builder.send().await?;
    /// # gax::Result::<()>::Ok(()) });
    ///
    /// fn prepare_request_builder() -> GetProjectIntelligenceConfig {
    ///   # panic!();
    ///   // ... details omitted ...
    /// }
    /// ```
    #[derive(Clone, Debug)]
    pub struct GetProjectIntelligenceConfig(
        RequestBuilder<crate::model::GetProjectIntelligenceConfigRequest>,
    );

    impl GetProjectIntelligenceConfig {
        pub(crate) fn new(
            stub: std::sync::Arc<dyn super::super::stub::dynamic::StorageControl>,
        ) -> Self {
            Self(RequestBuilder::new(stub))
        }

        /// Sets the full request, replacing any prior values.
        pub fn with_request<V: Into<crate::model::GetProjectIntelligenceConfigRequest>>(
            mut self,
            v: V,
        ) -> Self {
            self.0.request = v.into();
            self
        }

        /// Sets all the options, replacing any prior values.
        pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
            self.0.options = v.into();
            self
        }

        /// Sends the request.
        pub async fn send(self) -> Result<crate::model::IntelligenceConfig> {
            (*self.0.stub)
                .get_project_intelligence_config(self.0.request, self.0.options)
                .await
                .map(gax::response::Response::into_body)
        }

        /// Sets the value of [name][crate::model::GetProjectIntelligenceConfigRequest::name].
        ///
        /// This is a **required** field for requests.
        pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
            self.0.request.name = v.into();
            self
        }
    }

    #[doc(hidden)]
    impl gax::options::internal::RequestBuilder for GetProjectIntelligenceConfig {
        fn request_options(&mut self) -> &mut gax::options::RequestOptions {
            &mut self.0.options
        }
    }

    /// The request builder for [StorageControl::update_project_intelligence_config][crate::client::StorageControl::update_project_intelligence_config] calls.
    ///
    /// # Example
    /// ```no_run
    /// # use google_cloud_storage::builder;
    /// use builder::storage_control::UpdateProjectIntelligenceConfig;
    /// # tokio_test::block_on(async {
    ///
    /// let builder = prepare_request_builder();
    /// let response = builder.send().await?;
    /// # gax::Result::<()>::Ok(()) });
    ///
    /// fn prepare_request_builder() -> UpdateProjectIntelligenceConfig {
    ///   # panic!();
    ///   // ... details omitted ...
    /// }
    /// ```
    #[derive(Clone, Debug)]
    pub struct UpdateProjectIntelligenceConfig(
        RequestBuilder<crate::model::UpdateProjectIntelligenceConfigRequest>,
    );

    impl UpdateProjectIntelligenceConfig {
        pub(crate) fn new(
            stub: std::sync::Arc<dyn super::super::stub::dynamic::StorageControl>,
        ) -> Self {
            Self(RequestBuilder::new(stub))
        }

        /// Sets the full request, replacing any prior values.
        pub fn with_request<V: Into<crate::model::UpdateProjectIntelligenceConfigRequest>>(
            mut self,
            v: V,
        ) -> Self {
            self.0.request = v.into();
            self
        }

        /// Sets all the options, replacing any prior values.
        pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
            self.0.options = v.into();
            self
        }

        /// Sends the request.
        pub async fn send(self) -> Result<crate::model::IntelligenceConfig> {
            (*self.0.stub)
                .update_project_intelligence_config(self.0.request, self.0.options)
                .await
                .map(gax::response::Response::into_body)
        }

        /// Sets the value of [intelligence_config][crate::model::UpdateProjectIntelligenceConfigRequest::intelligence_config].
        ///
        /// This is a **required** field for requests.
        pub fn set_intelligence_config<T>(mut self, v: T) -> Self
        where
            T: std::convert::Into<crate::model::IntelligenceConfig>,
        {
            self.0.request.intelligence_config = std::option::Option::Some(v.into());
            self
        }

        /// Sets or clears the value of [intelligence_config][crate::model::UpdateProjectIntelligenceConfigRequest::intelligence_config].
        ///
        /// This is a **required** field for requests.
        pub fn set_or_clear_intelligence_config<T>(mut self, v: std::option::Option<T>) -> Self
        where
            T: std::convert::Into<crate::model::IntelligenceConfig>,
        {
            self.0.request.intelligence_config = v.map(|x| x.into());
            self
        }

        /// Sets the value of [update_mask][crate::model::UpdateProjectIntelligenceConfigRequest::update_mask].
        ///
        /// This is a **required** field for requests.
        pub fn set_update_mask<T>(mut self, v: T) -> Self
        where
            T: std::convert::Into<wkt::FieldMask>,
        {
            self.0.request.update_mask = std::option::Option::Some(v.into());
            self
        }

        /// Sets or clears the value of [update_mask][crate::model::UpdateProjectIntelligenceConfigRequest::update_mask].
        ///
        /// This is a **required** field for requests.
        pub fn set_or_clear_update_mask<T>(mut self, v: std::option::Option<T>) -> Self
        where
            T: std::convert::Into<wkt::FieldMask>,
        {
            self.0.request.update_mask = v.map(|x| x.into());
            self
        }

        /// Sets the value of [request_id][crate::model::UpdateProjectIntelligenceConfigRequest::request_id].
        pub fn set_request_id<T: Into<std::string::String>>(mut self, v: T) -> Self {
            self.0.request.request_id = v.into();
            self
        }
    }

    #[doc(hidden)]
    impl gax::options::internal::RequestBuilder for UpdateProjectIntelligenceConfig {
        fn request_options(&mut self) -> &mut gax::options::RequestOptions {
            &mut self.0.options
        }
    }

    /// The request builder for [StorageControl::get_folder_intelligence_config][crate::client::StorageControl::get_folder_intelligence_config] calls.
    ///
    /// # Example
    /// ```no_run
    /// # use google_cloud_storage::builder;
    /// use builder::storage_control::GetFolderIntelligenceConfig;
    /// # tokio_test::block_on(async {
    ///
    /// let builder = prepare_request_builder();
    /// let response = builder.send().await?;
    /// # gax::Result::<()>::Ok(()) });
    ///
    /// fn prepare_request_builder() -> GetFolderIntelligenceConfig {
    ///   # panic!();
    ///   // ... details omitted ...
    /// }
    /// ```
    #[derive(Clone, Debug)]
    pub struct GetFolderIntelligenceConfig(
        RequestBuilder<crate::model::GetFolderIntelligenceConfigRequest>,
    );

    impl GetFolderIntelligenceConfig {
        pub(crate) fn new(
            stub: std::sync::Arc<dyn super::super::stub::dynamic::StorageControl>,
        ) -> Self {
            Self(RequestBuilder::new(stub))
        }

        /// Sets the full request, replacing any prior values.
        pub fn with_request<V: Into<crate::model::GetFolderIntelligenceConfigRequest>>(
            mut self,
            v: V,
        ) -> Self {
            self.0.request = v.into();
            self
        }

        /// Sets all the options, replacing any prior values.
        pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
            self.0.options = v.into();
            self
        }

        /// Sends the request.
        pub async fn send(self) -> Result<crate::model::IntelligenceConfig> {
            (*self.0.stub)
                .get_folder_intelligence_config(self.0.request, self.0.options)
                .await
                .map(gax::response::Response::into_body)
        }

        /// Sets the value of [name][crate::model::GetFolderIntelligenceConfigRequest::name].
        ///
        /// This is a **required** field for requests.
        pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
            self.0.request.name = v.into();
            self
        }
    }

    #[doc(hidden)]
    impl gax::options::internal::RequestBuilder for GetFolderIntelligenceConfig {
        fn request_options(&mut self) -> &mut gax::options::RequestOptions {
            &mut self.0.options
        }
    }

    /// The request builder for [StorageControl::update_folder_intelligence_config][crate::client::StorageControl::update_folder_intelligence_config] calls.
    ///
    /// # Example
    /// ```no_run
    /// # use google_cloud_storage::builder;
    /// use builder::storage_control::UpdateFolderIntelligenceConfig;
    /// # tokio_test::block_on(async {
    ///
    /// let builder = prepare_request_builder();
    /// let response = builder.send().await?;
    /// # gax::Result::<()>::Ok(()) });
    ///
    /// fn prepare_request_builder() -> UpdateFolderIntelligenceConfig {
    ///   # panic!();
    ///   // ... details omitted ...
    /// }
    /// ```
    #[derive(Clone, Debug)]
    pub struct UpdateFolderIntelligenceConfig(
        RequestBuilder<crate::model::UpdateFolderIntelligenceConfigRequest>,
    );

    impl UpdateFolderIntelligenceConfig {
        pub(crate) fn new(
            stub: std::sync::Arc<dyn super::super::stub::dynamic::StorageControl>,
        ) -> Self {
            Self(RequestBuilder::new(stub))
        }

        /// Sets the full request, replacing any prior values.
        pub fn with_request<V: Into<crate::model::UpdateFolderIntelligenceConfigRequest>>(
            mut self,
            v: V,
        ) -> Self {
            self.0.request = v.into();
            self
        }

        /// Sets all the options, replacing any prior values.
        pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
            self.0.options = v.into();
            self
        }

        /// Sends the request.
        pub async fn send(self) -> Result<crate::model::IntelligenceConfig> {
            (*self.0.stub)
                .update_folder_intelligence_config(self.0.request, self.0.options)
                .await
                .map(gax::response::Response::into_body)
        }

        /// Sets the value of [intelligence_config][crate::model::UpdateFolderIntelligenceConfigRequest::intelligence_config].
        ///
        /// This is a **required** field for requests.
        pub fn set_intelligence_config<T>(mut self, v: T) -> Self
        where
            T: std::convert::Into<crate::model::IntelligenceConfig>,
        {
            self.0.request.intelligence_config = std::option::Option::Some(v.into());
            self
        }

        /// Sets or clears the value of [intelligence_config][crate::model::UpdateFolderIntelligenceConfigRequest::intelligence_config].
        ///
        /// This is a **required** field for requests.
        pub fn set_or_clear_intelligence_config<T>(mut self, v: std::option::Option<T>) -> Self
        where
            T: std::convert::Into<crate::model::IntelligenceConfig>,
        {
            self.0.request.intelligence_config = v.map(|x| x.into());
            self
        }

        /// Sets the value of [update_mask][crate::model::UpdateFolderIntelligenceConfigRequest::update_mask].
        ///
        /// This is a **required** field for requests.
        pub fn set_update_mask<T>(mut self, v: T) -> Self
        where
            T: std::convert::Into<wkt::FieldMask>,
        {
            self.0.request.update_mask = std::option::Option::Some(v.into());
            self
        }

        /// Sets or clears the value of [update_mask][crate::model::UpdateFolderIntelligenceConfigRequest::update_mask].
        ///
        /// This is a **required** field for requests.
        pub fn set_or_clear_update_mask<T>(mut self, v: std::option::Option<T>) -> Self
        where
            T: std::convert::Into<wkt::FieldMask>,
        {
            self.0.request.update_mask = v.map(|x| x.into());
            self
        }

        /// Sets the value of [request_id][crate::model::UpdateFolderIntelligenceConfigRequest::request_id].
        pub fn set_request_id<T: Into<std::string::String>>(mut self, v: T) -> Self {
            self.0.request.request_id = v.into();
            self
        }
    }

    #[doc(hidden)]
    impl gax::options::internal::RequestBuilder for UpdateFolderIntelligenceConfig {
        fn request_options(&mut self) -> &mut gax::options::RequestOptions {
            &mut self.0.options
        }
    }

    /// The request builder for [StorageControl::get_organization_intelligence_config][crate::client::StorageControl::get_organization_intelligence_config] calls.
    ///
    /// # Example
    /// ```no_run
    /// # use google_cloud_storage::builder;
    /// use builder::storage_control::GetOrganizationIntelligenceConfig;
    /// # tokio_test::block_on(async {
    ///
    /// let builder = prepare_request_builder();
    /// let response = builder.send().await?;
    /// # gax::Result::<()>::Ok(()) });
    ///
    /// fn prepare_request_builder() -> GetOrganizationIntelligenceConfig {
    ///   # panic!();
    ///   // ... details omitted ...
    /// }
    /// ```
    #[derive(Clone, Debug)]
    pub struct GetOrganizationIntelligenceConfig(
        RequestBuilder<crate::model::GetOrganizationIntelligenceConfigRequest>,
    );

    impl GetOrganizationIntelligenceConfig {
        pub(crate) fn new(
            stub: std::sync::Arc<dyn super::super::stub::dynamic::StorageControl>,
        ) -> Self {
            Self(RequestBuilder::new(stub))
        }

        /// Sets the full request, replacing any prior values.
        pub fn with_request<V: Into<crate::model::GetOrganizationIntelligenceConfigRequest>>(
            mut self,
            v: V,
        ) -> Self {
            self.0.request = v.into();
            self
        }

        /// Sets all the options, replacing any prior values.
        pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
            self.0.options = v.into();
            self
        }

        /// Sends the request.
        pub async fn send(self) -> Result<crate::model::IntelligenceConfig> {
            (*self.0.stub)
                .get_organization_intelligence_config(self.0.request, self.0.options)
                .await
                .map(gax::response::Response::into_body)
        }

        /// Sets the value of [name][crate::model::GetOrganizationIntelligenceConfigRequest::name].
        ///
        /// This is a **required** field for requests.
        pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
            self.0.request.name = v.into();
            self
        }
    }

    #[doc(hidden)]
    impl gax::options::internal::RequestBuilder for GetOrganizationIntelligenceConfig {
        fn request_options(&mut self) -> &mut gax::options::RequestOptions {
            &mut self.0.options
        }
    }

    /// The request builder for [StorageControl::update_organization_intelligence_config][crate::client::StorageControl::update_organization_intelligence_config] calls.
    ///
    /// # Example
    /// ```no_run
    /// # use google_cloud_storage::builder;
    /// use builder::storage_control::UpdateOrganizationIntelligenceConfig;
    /// # tokio_test::block_on(async {
    ///
    /// let builder = prepare_request_builder();
    /// let response = builder.send().await?;
    /// # gax::Result::<()>::Ok(()) });
    ///
    /// fn prepare_request_builder() -> UpdateOrganizationIntelligenceConfig {
    ///   # panic!();
    ///   // ... details omitted ...
    /// }
    /// ```
    #[derive(Clone, Debug)]
    pub struct UpdateOrganizationIntelligenceConfig(
        RequestBuilder<crate::model::UpdateOrganizationIntelligenceConfigRequest>,
    );

    impl UpdateOrganizationIntelligenceConfig {
        pub(crate) fn new(
            stub: std::sync::Arc<dyn super::super::stub::dynamic::StorageControl>,
        ) -> Self {
            Self(RequestBuilder::new(stub))
        }

        /// Sets the full request, replacing any prior values.
        pub fn with_request<V: Into<crate::model::UpdateOrganizationIntelligenceConfigRequest>>(
            mut self,
            v: V,
        ) -> Self {
            self.0.request = v.into();
            self
        }

        /// Sets all the options, replacing any prior values.
        pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
            self.0.options = v.into();
            self
        }

        /// Sends the request.
        pub async fn send(self) -> Result<crate::model::IntelligenceConfig> {
            (*self.0.stub)
                .update_organization_intelligence_config(self.0.request, self.0.options)
                .await
                .map(gax::response::Response::into_body)
        }

        /// Sets the value of [intelligence_config][crate::model::UpdateOrganizationIntelligenceConfigRequest::intelligence_config].
        ///
        /// This is a **required** field for requests.
        pub fn set_intelligence_config<T>(mut self, v: T) -> Self
        where
            T: std::convert::Into<crate::model::IntelligenceConfig>,
        {
            self.0.request.intelligence_config = std::option::Option::Some(v.into());
            self
        }

        /// Sets or clears the value of [intelligence_config][crate::model::UpdateOrganizationIntelligenceConfigRequest::intelligence_config].
        ///
        /// This is a **required** field for requests.
        pub fn set_or_clear_intelligence_config<T>(mut self, v: std::option::Option<T>) -> Self
        where
            T: std::convert::Into<crate::model::IntelligenceConfig>,
        {
            self.0.request.intelligence_config = v.map(|x| x.into());
            self
        }

        /// Sets the value of [update_mask][crate::model::UpdateOrganizationIntelligenceConfigRequest::update_mask].
        ///
        /// This is a **required** field for requests.
        pub fn set_update_mask<T>(mut self, v: T) -> Self
        where
            T: std::convert::Into<wkt::FieldMask>,
        {
            self.0.request.update_mask = std::option::Option::Some(v.into());
            self
        }

        /// Sets or clears the value of [update_mask][crate::model::UpdateOrganizationIntelligenceConfigRequest::update_mask].
        ///
        /// This is a **required** field for requests.
        pub fn set_or_clear_update_mask<T>(mut self, v: std::option::Option<T>) -> Self
        where
            T: std::convert::Into<wkt::FieldMask>,
        {
            self.0.request.update_mask = v.map(|x| x.into());
            self
        }

        /// Sets the value of [request_id][crate::model::UpdateOrganizationIntelligenceConfigRequest::request_id].
        pub fn set_request_id<T: Into<std::string::String>>(mut self, v: T) -> Self {
            self.0.request.request_id = v.into();
            self
        }
    }

    #[doc(hidden)]
    impl gax::options::internal::RequestBuilder for UpdateOrganizationIntelligenceConfig {
        fn request_options(&mut self) -> &mut gax::options::RequestOptions {
            &mut self.0.options
        }
    }

    /// The request builder for [StorageControl::get_iam_policy][crate::client::StorageControl::get_iam_policy] calls.
    ///
    /// # Example
    /// ```no_run
    /// # use google_cloud_storage::builder;
    /// use builder::storage_control::GetIamPolicy;
    /// # tokio_test::block_on(async {
    ///
    /// let builder = prepare_request_builder();
    /// let response = builder.send().await?;
    /// # gax::Result::<()>::Ok(()) });
    ///
    /// fn prepare_request_builder() -> GetIamPolicy {
    ///   # panic!();
    ///   // ... details omitted ...
    /// }
    /// ```
    #[derive(Clone, Debug)]
    pub struct GetIamPolicy(RequestBuilder<iam_v1::model::GetIamPolicyRequest>);

    impl GetIamPolicy {
        pub(crate) fn new(
            stub: std::sync::Arc<dyn super::super::stub::dynamic::StorageControl>,
        ) -> Self {
            Self(RequestBuilder::new(stub))
        }

        /// Sets the full request, replacing any prior values.
        pub fn with_request<V: Into<iam_v1::model::GetIamPolicyRequest>>(mut self, v: V) -> Self {
            self.0.request = v.into();
            self
        }

        /// Sets all the options, replacing any prior values.
        pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
            self.0.options = v.into();
            self
        }

        /// Sends the request.
        pub async fn send(self) -> Result<iam_v1::model::Policy> {
            (*self.0.stub)
                .get_iam_policy(self.0.request, self.0.options)
                .await
                .map(gax::response::Response::into_body)
        }

        /// Sets the value of [resource][iam_v1::model::GetIamPolicyRequest::resource].
        ///
        /// This is a **required** field for requests.
        pub fn set_resource<T: Into<std::string::String>>(mut self, v: T) -> Self {
            self.0.request.resource = v.into();
            self
        }

        /// Sets the value of [options][iam_v1::model::GetIamPolicyRequest::options].
        pub fn set_options<T>(mut self, v: T) -> Self
        where
            T: std::convert::Into<iam_v1::model::GetPolicyOptions>,
        {
            self.0.request.options = std::option::Option::Some(v.into());
            self
        }

        /// Sets or clears the value of [options][iam_v1::model::GetIamPolicyRequest::options].
        pub fn set_or_clear_options<T>(mut self, v: std::option::Option<T>) -> Self
        where
            T: std::convert::Into<iam_v1::model::GetPolicyOptions>,
        {
            self.0.request.options = v.map(|x| x.into());
            self
        }
    }

    #[doc(hidden)]
    impl gax::options::internal::RequestBuilder for GetIamPolicy {
        fn request_options(&mut self) -> &mut gax::options::RequestOptions {
            &mut self.0.options
        }
    }

    /// The request builder for [StorageControl::set_iam_policy][crate::client::StorageControl::set_iam_policy] calls.
    ///
    /// # Example
    /// ```no_run
    /// # use google_cloud_storage::builder;
    /// use builder::storage_control::SetIamPolicy;
    /// # tokio_test::block_on(async {
    ///
    /// let builder = prepare_request_builder();
    /// let response = builder.send().await?;
    /// # gax::Result::<()>::Ok(()) });
    ///
    /// fn prepare_request_builder() -> SetIamPolicy {
    ///   # panic!();
    ///   // ... details omitted ...
    /// }
    /// ```
    #[derive(Clone, Debug)]
    pub struct SetIamPolicy(RequestBuilder<iam_v1::model::SetIamPolicyRequest>);

    impl SetIamPolicy {
        pub(crate) fn new(
            stub: std::sync::Arc<dyn super::super::stub::dynamic::StorageControl>,
        ) -> Self {
            Self(RequestBuilder::new(stub))
        }

        /// Sets the full request, replacing any prior values.
        pub fn with_request<V: Into<iam_v1::model::SetIamPolicyRequest>>(mut self, v: V) -> Self {
            self.0.request = v.into();
            self
        }

        /// Sets all the options, replacing any prior values.
        pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
            self.0.options = v.into();
            self
        }

        /// Sends the request.
        pub async fn send(self) -> Result<iam_v1::model::Policy> {
            (*self.0.stub)
                .set_iam_policy(self.0.request, self.0.options)
                .await
                .map(gax::response::Response::into_body)
        }

        /// Sets the value of [resource][iam_v1::model::SetIamPolicyRequest::resource].
        ///
        /// This is a **required** field for requests.
        pub fn set_resource<T: Into<std::string::String>>(mut self, v: T) -> Self {
            self.0.request.resource = v.into();
            self
        }

        /// Sets the value of [policy][iam_v1::model::SetIamPolicyRequest::policy].
        ///
        /// This is a **required** field for requests.
        pub fn set_policy<T>(mut self, v: T) -> Self
        where
            T: std::convert::Into<iam_v1::model::Policy>,
        {
            self.0.request.policy = std::option::Option::Some(v.into());
            self
        }

        /// Sets or clears the value of [policy][iam_v1::model::SetIamPolicyRequest::policy].
        ///
        /// This is a **required** field for requests.
        pub fn set_or_clear_policy<T>(mut self, v: std::option::Option<T>) -> Self
        where
            T: std::convert::Into<iam_v1::model::Policy>,
        {
            self.0.request.policy = v.map(|x| x.into());
            self
        }

        /// Sets the value of [update_mask][iam_v1::model::SetIamPolicyRequest::update_mask].
        pub fn set_update_mask<T>(mut self, v: T) -> Self
        where
            T: std::convert::Into<wkt::FieldMask>,
        {
            self.0.request.update_mask = std::option::Option::Some(v.into());
            self
        }

        /// Sets or clears the value of [update_mask][iam_v1::model::SetIamPolicyRequest::update_mask].
        pub fn set_or_clear_update_mask<T>(mut self, v: std::option::Option<T>) -> Self
        where
            T: std::convert::Into<wkt::FieldMask>,
        {
            self.0.request.update_mask = v.map(|x| x.into());
            self
        }
    }

    #[doc(hidden)]
    impl gax::options::internal::RequestBuilder for SetIamPolicy {
        fn request_options(&mut self) -> &mut gax::options::RequestOptions {
            &mut self.0.options
        }
    }

    /// The request builder for [StorageControl::test_iam_permissions][crate::client::StorageControl::test_iam_permissions] calls.
    ///
    /// # Example
    /// ```no_run
    /// # use google_cloud_storage::builder;
    /// use builder::storage_control::TestIamPermissions;
    /// # tokio_test::block_on(async {
    ///
    /// let builder = prepare_request_builder();
    /// let response = builder.send().await?;
    /// # gax::Result::<()>::Ok(()) });
    ///
    /// fn prepare_request_builder() -> TestIamPermissions {
    ///   # panic!();
    ///   // ... details omitted ...
    /// }
    /// ```
    #[derive(Clone, Debug)]
    pub struct TestIamPermissions(RequestBuilder<iam_v1::model::TestIamPermissionsRequest>);

    impl TestIamPermissions {
        pub(crate) fn new(
            stub: std::sync::Arc<dyn super::super::stub::dynamic::StorageControl>,
        ) -> Self {
            Self(RequestBuilder::new(stub))
        }

        /// Sets the full request, replacing any prior values.
        pub fn with_request<V: Into<iam_v1::model::TestIamPermissionsRequest>>(
            mut self,
            v: V,
        ) -> Self {
            self.0.request = v.into();
            self
        }

        /// Sets all the options, replacing any prior values.
        pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
            self.0.options = v.into();
            self
        }

        /// Sends the request.
        pub async fn send(self) -> Result<iam_v1::model::TestIamPermissionsResponse> {
            (*self.0.stub)
                .test_iam_permissions(self.0.request, self.0.options)
                .await
                .map(gax::response::Response::into_body)
        }

        /// Sets the value of [resource][iam_v1::model::TestIamPermissionsRequest::resource].
        ///
        /// This is a **required** field for requests.
        pub fn set_resource<T: Into<std::string::String>>(mut self, v: T) -> Self {
            self.0.request.resource = v.into();
            self
        }

        /// Sets the value of [permissions][iam_v1::model::TestIamPermissionsRequest::permissions].
        ///
        /// This is a **required** field for requests.
        pub fn set_permissions<T, V>(mut self, v: T) -> Self
        where
            T: std::iter::IntoIterator<Item = V>,
            V: std::convert::Into<std::string::String>,
        {
            use std::iter::Iterator;
            self.0.request.permissions = v.into_iter().map(|i| i.into()).collect();
            self
        }
    }

    #[doc(hidden)]
    impl gax::options::internal::RequestBuilder for TestIamPermissions {
        fn request_options(&mut self) -> &mut gax::options::RequestOptions {
            &mut self.0.options
        }
    }

    /// The request builder for [StorageControl::get_operation][crate::client::StorageControl::get_operation] calls.
    ///
    /// # Example
    /// ```no_run
    /// # use google_cloud_storage::builder;
    /// use builder::storage_control::GetOperation;
    /// # tokio_test::block_on(async {
    ///
    /// let builder = prepare_request_builder();
    /// let response = builder.send().await?;
    /// # gax::Result::<()>::Ok(()) });
    ///
    /// fn prepare_request_builder() -> GetOperation {
    ///   # panic!();
    ///   // ... details omitted ...
    /// }
    /// ```
    #[derive(Clone, Debug)]
    pub struct GetOperation(RequestBuilder<longrunning::model::GetOperationRequest>);

    impl GetOperation {
        pub(crate) fn new(
            stub: std::sync::Arc<dyn super::super::stub::dynamic::StorageControl>,
        ) -> Self {
            Self(RequestBuilder::new(stub))
        }

        /// Sets the full request, replacing any prior values.
        pub fn with_request<V: Into<longrunning::model::GetOperationRequest>>(
            mut self,
            v: V,
        ) -> Self {
            self.0.request = v.into();
            self
        }

        /// Sets all the options, replacing any prior values.
        pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
            self.0.options = v.into();
            self
        }

        /// Sends the request.
        pub async fn send(self) -> Result<longrunning::model::Operation> {
            (*self.0.stub)
                .get_operation(self.0.request, self.0.options)
                .await
                .map(gax::response::Response::into_body)
        }

        /// Sets the value of [name][longrunning::model::GetOperationRequest::name].
        pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
            self.0.request.name = v.into();
            self
        }
    }

    #[doc(hidden)]
    impl gax::options::internal::RequestBuilder for GetOperation {
        fn request_options(&mut self) -> &mut gax::options::RequestOptions {
            &mut self.0.options
        }
    }
}
